// let p = []

function _instanceof(target, source) {
    let p = target.__proto__, s = source.prototype
    while(true) {
        if(p == null) {
            return false
        }
        if(p == s) {
            return true
        }
        p = p.__proto__
    }
}

console.log(_instanceof([], Array));

function _new(target, ...arguments) {
    let obj = {}
    obj.__proto__ = target.prototype
   let result = target.apply(obj, arguments)
    return result instanceof 'object' ? result : obj
}

// let s = _new(_instanceof)

// let s = new _instanceof([], Array)
